package com.longer.studentmvp.retrofit;

import com.longer.studentmvp.model.bean.WeatherJson;

import retrofit2.GsonConverterFactory;
import retrofit2.Retrofit;
import retrofit2.RxJavaCallAdapterFactory;
import retrofit2.http.GET;
import retrofit2.http.Path;
import rx.Observable;

/**
 * Created by longer on 2017/4/10.
 */

public class AppClient {
    static Retrofit mretrofit;

    public static Retrofit retrofit() {
        if (mretrofit == null) {
            mretrofit = new Retrofit.Builder()
                    .baseUrl("http://www.weather.com.cn/")
                    .addConverterFactory(GsonConverterFactory.create())
                    .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
                    .build();
        }
        return mretrofit;
    }

//    public interface ApiStores {
//        @GET("adat/sk/{cityId}.html")
//        Call<WeatherJson> getWeather(@Path("cityId") String cityID);
//    }
    public interface ApiStores {
        @GET("adat/sk/{cityId}.html")
        Observable<WeatherJson> getWeatherRxjava(@Path("cityId") String cityID);
    }

}
